package com.hzyc.internetshop.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hzyc.internetshop.bean.Article;
import com.hzyc.internetshop.bean.Comment;
import com.hzyc.internetshop.bean.Fankui;
import com.hzyc.internetshop.bean.Goods;
import com.hzyc.internetshop.bean.Gys;
import com.hzyc.internetshop.bean.IdList;
import com.hzyc.internetshop.bean.Lianjie;
import com.hzyc.internetshop.bean.Orders;
import com.hzyc.internetshop.bean.Page;
import com.hzyc.internetshop.bean.Question;
import com.hzyc.internetshop.bean.Types;
import com.hzyc.internetshop.bean.User;
import com.hzyc.internetshop.mapper.Typemapper;
import com.hzyc.internetshop.service.TypeService;

@Service
public class TypeServiceImp implements TypeService{
	@Autowired
	private Typemapper tm;
	@Override
	public boolean addType(String type) {
	
		boolean bol=false;
		try {
			int i=tm.addtype(type);
			if(i>0){
				bol=true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public List<Types> showType() {
		List<Types> list = null;
		try {
			
			list=tm.showtype();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return list;
	}
	@Override
	public boolean deletetype(IdList id) {
	
		boolean bol =false;
		try {
			
			int i=tm.deletetype(id);
			if(i>0){
				bol=true;
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return bol;
	}
	@Override
	public boolean addgood(Goods good) {
		boolean bol=false;
		try {
			int i=tm.addgood(good);
			if(i>0){
				bol=true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	
	@Override
	public List<Goods> showgoods(Page page) {
		List<Goods> goods = null;
		try {
			 goods=tm.showgoods(page);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
		return goods;
	}
	@Override
	public int getgoodnum() {
		
		return tm.getgoodnum();
	}
	@Override
	public boolean deletegood(String id) {
		boolean bol=false;
		try {
			tm.deletegood(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public boolean updategood(Goods g) {
		boolean bol=false;
		try {
			tm.updategood(g);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}		
			return bol;	
	}
	@Override
	public Goods getGoodById(String id) {
		// TODO Auto-generated method stub
		return tm.getGoodById(id);
	}
	@Override
	public List<Article> showarticles(Page page) {
		List<Article> articles = null;
		try {
			articles=tm.showarticles(page);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
		return articles;
	}
	@Override
	public Article getArticleById(String id) {
		return tm.getArticleById(id);
	}
	@Override
	public boolean deletearticle(String id) {
		boolean bol=false;
		try {
			tm.deletearticle(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
		
	}
	@Override
	public boolean deleteorder(String id) {
		boolean bol=false;
		try {
			tm.deleteorder(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public List<User> selectvip(Page page) {
		List<User> user = null;
		try {
			 user=tm.selectvip(page);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
		return user;
	}
	@Override
	public int getarticlenum() {
		// TODO Auto-generated method stub
		return tm.getarticlenum();
	}
	@Override
	public int getusernum() {
		// TODO Auto-generated method stub
		return tm.getusernum();
	}
	@Override
	public List<Fankui> getFankuiById(String id) {
		// TODO Auto-generated method stub
		return tm.getFankuiById(id);
	}
	@Override
	public boolean addgys(String name) {
		boolean bol=false;
		try {
			int i=tm.addgys(name);
			if(i>0){
				bol=true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public List<Gys> showgys() {
		List<Gys> list = null;
		try {
			
			list=tm.showgys();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return list;
	}
	@Override
	public boolean deletegys(IdList id) {
		boolean bol =false;
		try {
			
			int i=tm.deletegys(id);
			if(i>0){
				bol=true;
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return bol;
	}
	@Override
	public List<Fankui> showFk() {
		// TODO Auto-generated method stub
		return tm.showFk();
	}
	@Override
	public boolean addHelp(Question q) {
		boolean bol=false;
		try {
			int i=tm.addHelp(q);
			if(i>0){
				bol=true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public int gethelpnum() {
		
		return tm.gethelpnum();
	}
	@Override
	public List<Question> showhelp(Page page) {
		// TODO Auto-generated method stub
		return tm.showhelp(page);
	}
	@Override
	public Question getHelpById(String id) {
		// TODO Auto-generated method stub
		return tm.getHelpById(id);
	}
	@Override
	public boolean updatehelp(Question q) {
		boolean bol=false;
		try {
			tm.updatehelp(q);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}		
			return bol;	
	}
	@Override
	public boolean deletehelp(String id) {
		boolean bol=false;
		try {
			tm.deletehelp(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public List<Comment> getCommentById(String id) {
		// TODO Auto-generated method stub
		return tm.getCommentById(id);
	}
	@Override
	public boolean addlj(Lianjie lj) {
		boolean bol=false;
		try {
			int i=tm.addlj(lj);
			if(i>0){
				bol=true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public int getljnum() {
		// TODO Auto-generated method stub
		return tm.getljnum();
	}
	@Override
	public List<Lianjie> showlj(Page page) {
		// TODO Auto-generated method stub
		return tm.showlj(page);
	}
	@Override
	public Lianjie getLjById(String id) {
		// TODO Auto-generated method stub
		return tm.getLjById(id);
	}
	@Override
	public boolean updatelj(Lianjie lj) {
		boolean bol=false;
		try {
			tm.updatelj(lj);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}		
			return bol;	
	}
	@Override
	public boolean deletelj(String id) {
		boolean bol=false;
		try {
			tm.deletelj(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bol;
	}
	@Override
	public Orders getOrderById(String id) {
		// TODO Auto-generated method stub
		return tm.getOrderById(id);
	}
	@Override
	public boolean updateorder(Orders o) {
		boolean bol=false;
		try {
			tm.updateorder(o);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}		
			return bol;	
	}
	@Override
	public boolean updatefh(String id) {
		boolean bol=false;
		try {
			tm.updatefh(id);
			bol=true;
		} catch (Exception e) {
			e.printStackTrace();
		}		
			return bol;	
	}
	
}
